<div class="card">
    <div class="card-block">
        <form id="form1">
            {#options_text_bit
            <div class="form-group">
                <label for="name">{info}</label>
                <input type="text" class="form-control" id="{options_name}" name="{options_name}" value="{options_value}">
            </div>
            #}
            {#options_number_bit
            <div class="form-group">
            <label for="name">{info}</label>
            <input type="number" class="form-control" id="{options_name}" name="{options_name}" value="{options_value}">
            </div>
            #}
            {#options_boolean_bit
            <div class="form-group">
            <label for="name">{info}</label>
            <label><input name="{options_name}" type="radio" value="1" {checked1}>是</label>
            <label><input type="radio" name="{options_name}" value="0" {checked0}>否</label>
            </div>
            #}
            {#options_select_bit
            <div class="form-group">
            <label for="name">{info}</label>
            <select name="{options_name}" id="{options_name}">{select_list}</select>
            </div>
            #}
            {#options_textarea_bit
            <div class="form-group">
            <label for="name">{info}</label>
            <textarea name="{options_name}" id="{options_name}" cols="60" rows="6">{options_value}</textarea>
            </div>
            #}
            {options_list}
            <button type="submit" class="btn btn-primary"><i class="fa fa-save" /> 保存</button>
            <input type="hidden" name="category" value="{category}">
        </form>
    </div>
</div>

<script type="text/javascript">
    $("#form1").submit(function () {
        $.ajax({
            url: "?m=configure&a=edit_save",
            type: "POST",
            data: $("#form1").serialize(),
            dataType: "json",
            error: function(xhr,textStatus){
                alert(textStatus);
            },
            success: function (data,textStatus,jqXHR) {
                if(data.status == "error") {
                    alert(data.msg);
                } else {
                    alert("保存设置完成");
                    _refresh_page();
                }
            }
        });
        return false;
    });
</script>